<script setup lang="ts">

import { ShowModel } from '@/api/webSite/response';
import { defineProps } from 'vue';
const { moiveInfo } = defineProps<{
  moiveInfo: ShowModel
}>();

function getStyle(): string {
  return `background-image: url('${moiveInfo.cover}');`;
}

function openMovieLink() {
  window.open(moiveInfo.link, "_blank");
}

</script>


<template>
  <div class="card" @click="openMovieLink">
    <div class="top-section" :style="getStyle()">
      <div class="border"></div>
      <div class="icons">
        <div class="logo">
          <svgIcon name="moive">
          </svgIcon>
        </div>
      </div>
    </div>
    <div class="bottom-section">
      <span class="title">{{ moiveInfo.name }}</span>
      <div class="row row1">
        <div class="item">
          <span class="big-text">{{ moiveInfo.top }}</span>
          <span class="regular-text">票房</span>
        </div>
        <div class="item">
          <span class="big-text">{{ moiveInfo.score }}</span>
          <span class="regular-text">评分</span>
        </div>
        <div class="item">
          <span class="big-text">{{ moiveInfo.year }}</span>
          <span class="regular-text">年份</span>
        </div>
      </div>
    </div>
  </div>
</template>



<style scoped lang="scss">
.card {
  width: 230px;
  border-radius: 20px;
  background: #1b233d;
  padding: 5px;
  overflow: hidden;
  box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 20px 0px;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  &:hover {
    transform: scale(1.05);
    cursor: pointer;
  }

  .top-section {
    background-size: cover;
    height: 250px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    position: relative;

    &::before {
      content: "";
      position: absolute;
      top: 30px;
      left: 0;
      background: rgba(255, 255, 255, 0);
      height: 15px;
      width: 15px;
      border-top-left-radius: 15px;
      box-shadow: -5px -5px 0 2px #1b233d;
    }

    .border {
      border-bottom-right-radius: 10px;
      height: 30px;
      width: 130px;
      background: white;
      background: #1b233d;
      position: relative;
      transform: skew(-40deg);
      box-shadow: -10px -10px 0 0 #1b233d;

      &::before {
        content: "";
        position: absolute;
        width: 15px;
        height: 15px;
        top: 0;
        right: -15px;
        background: rgba(255, 255, 255, 0);
        border-top-left-radius: 10px;
        box-shadow: -5px -5px 0 2px #1b233d;
      }
    }

    .icons {
      position: absolute;
      top: 0;
      width: 100%;
      height: 30px;
      display: flex;
      justify-content: space-between;

      .logo {
        height: 100%;
        aspect-ratio: 1;
        padding: 0px 0 7px 15px;

        svg {
          width: 25px;
          height: 25px;
        }

        .top-section {
          height: 100%;
        }
      }

      .social-media {
        height: 100%;
        padding: 4px 10px;
        display: flex;
        gap: 7px;

        .svg {
          height: 100%;
          fill: #1b233d;

          &:hover {
            fill: white;
          }
        }
      }
    }
  }

  .bottom-section {
    margin-top: 15px;
    padding: 10px 5px;

    .title {
      display: block;
      font-size: 17px;
      font-weight: bolder;
      color: white;
      text-align: center;
      letter-spacing: 2px;
    }

    .row {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;

      .item {
        flex: 30%;
        text-align: center;
        padding: 5px;
        color: rgba(170, 222, 243, 0.721);

        .big-text {
          font-size: 12px;
          display: block;
        }

        .regular-text {
          font-size: 9px;
        }
      }

      .item:nth-child(2) {
        border-left: 1px solid rgba(255, 255, 255, 0.126);
        border-right: 1px solid rgba(255, 255, 255, 0.126);
      }
    }
  }
}
</style>
